<template>
  <div id="main" />
</template>

<script>
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts'

export default {
  name: 'Radar',
  data() {
    return {}
  },
  created() {

  },
  mounted() {
    this.initEcharts()
  },
  methods: {
    initEcharts() {
      // 基于准备好的dom，初始化echarts实例
      const myChart = echarts.init(document.getElementById('main'))
      const option = {
        title: {
          text: 'Basic Radar Chart'
        },
        legend: {
          data: ['Allocated Budget', 'Actual Spending']
        },
        radar: {
          // shape: 'circle',
          indicator: [
            { name: '007', max: 100 },
            { name: '午休', max: 100 },
            { name: '睡觉', max: 100 },
            { name: '打游戏', max: 100 },
            { name: '摸鱼', max: 100 },
            { name: '打豆豆', max: 100 }
          ],
          splitArea: {
            show: false
          }
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            color: ['red', 'blue'],
            data: [
              {
                value: [100, 100, 100, 100, 22, 98],
                name: 'Allocated Budget'
              },
              {
                value: [23, 67, 89, 89, 54, 43],
                name: 'Actual Spending'
              }
            ]
          }
        ]
      }
      // 绘制图表
      myChart.setOption(option)
    }
  }
}
</script>

<style scoped lang='scss'>
#main {
  width: 500px;
  height: 500px;
}
</style>
